package com.settlement.system.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.settlement.system.common.result.PageResult;
import com.settlement.system.common.result.Result;
import com.settlement.system.model.query.OrderPageQuery;
import com.settlement.system.model.vo.SysOrderVO;
import com.settlement.system.service.SysOrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 标准订单 前端控制器
 * </p>
 *
 * @author huangrensen
 * @since 2023-09-20
 */
@RestController
@RequestMapping("/api/v1/order")
@RequiredArgsConstructor
public class SysOrderController {

    private final SysOrderService sysOrderService;

    @Operation(summary = "标准订单分页列表", security = {@SecurityRequirement(name = "Authorization")})
    @GetMapping("/page")
    public PageResult<SysOrderVO> getBillPage(@ParameterObject OrderPageQuery queryParams) {
        Page<SysOrderVO> result = sysOrderService.getOrderPage(queryParams);
        return PageResult.success(result);
    }

    @Operation(summary = "标准订单分字段列表", security = {@SecurityRequirement(name = "Authorization")})
    @GetMapping("/columnList")
    public Result<?> columnList() {
        return Result.success(sysOrderService.columnList());
    }
}
